package com.jerp.ui.main;

import java.util.ArrayList;
import java.util.List;

public class MenuItem {

	private final List<MenuItem> children;
	private final UiDescriptor desc;
	private String roleId;

	public MenuItem(String label, String roleId) {
		this.desc = new UiDescriptor(label);
		this.roleId = roleId;
		this.children = new ArrayList<MenuItem>();
	}

	public MenuItem(String label, String contPath, String roleId) {
		this.desc = new UiDescriptor(label, contPath);
		this.roleId = roleId;
		this.children = new ArrayList<MenuItem>();
	}

	public MenuItem(String label, String imgPath, String contPath, String roleId) {
		this.desc = new UiDescriptor(label, contPath, imgPath);
		this.roleId = roleId;
		this.children = new ArrayList<MenuItem>();
	}

	public MenuItem(String label, List<MenuItem> children) {
		this.desc = new UiDescriptor(label);
		this.children = children;
	}

	public String getRoleId() {
		return roleId;
	}

	public boolean isEmpty() {
		return children.isEmpty();
	}

	public boolean addChild(MenuItem child) {
		return children.add(child);
	}

	public boolean removeChild(MenuItem child) {
		return children.remove(child);
	}

	public UiDescriptor getDesc() {
		return desc;
	}

	public String getLabel() {
		return desc.getLabel();
	}

	public String getImgPath() {
		return desc.getImgPath();
	}

	public String getContPath() {
		return desc.getContPath();
	}

	public List<MenuItem> getChildren() {
		return children;
	}

}
